<?php
function nino_contact_pro_render_form($formId) {
	$render_html = "";
	
	$form = nino_contact_pro_get_contact($formId);
	if ($form != null) {
		$mapContent = json_decode($form->mapContent);
		//Build content
		foreach ($mapContent as $elements) {
			$render_html .= contact_elements_render($elements->type, $elements);
		}
	}
	
	echo $render_html;
}

function nino_contact_pro_short_code ($atts) {
	$formId = "";
	foreach ($atts as $value) {
		if (strpos($value, "id") !== false) {
			$arr = explode(":", $value);
			$formId = $arr[1];
		}
	}
	
	if ($formId != "") {
		nino_contact_pro_render_form($formId);
	}
}

add_shortcode( 'nino_contact_form_pro', 'nino_contact_pro_short_code' );
add_filter('widget_text', 'do_shortcode');